from gensim.models import Word2Vec
from gensim.corpora import Dictionary
import numpy as np

model=Word2Vec.load('word2vec.model')

dic=Dictionary.load('word.dict')

length=len(dic.keys())

j=0
with open('word.vectors','w',encoding='utf-8') as wf:
    wf.write(str(length)+' '+'300\n')
    for i,word in enumerate(dic.itervalues()):
        if word in model.wv:
            j+=1
            wordlist=model.wv[word].tolist()
            vectors=''
            for vc in wordlist:
                vectors=vectors+' '+str(vc)
            wf.write(word+' '+vectors.strip()+'\n')
print(j)